package com.ruoyi.tuanzhang.mapper.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.tuanzhang.domain.DarenBaseDo;
import com.ruoyi.tuanzhang.mapper.DarenBaseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Objects;

/**
 * 达人base
 * */
@Component
public class DarenBaseMapperImpl {

    @Autowired
    private static DarenBaseMapper darenBaseMapper;
    private DarenBaseMapperImpl (DarenBaseMapper mapper) {
        darenBaseMapper = mapper;
    }

    /**
     * 根据union_uid获取用户base信息
     * */
    public static DarenBaseDo getDarenBaseByUnionUid(String uid) {
        if (Objects.isNull(uid)) {
            return null;
        }
        QueryWrapper<DarenBaseDo> wrapper = new QueryWrapper<>();
        wrapper.eq("union_uid", uid);

        return darenBaseMapper.selectOne(wrapper);
    }

}
